#include<iostream>
#include<cmath>
using namespace std;
class C2D
{
    protected:
        double x,y;
    public:
        C2D(double _x,double _y):x(_x),y(_y){ }
        double getDistance()
        {
            return sqrt(x*x+y*y);
        }
};
class C3D:public C2D
{
    protected:
        double z;
    public:
        C3D(double _x,double _y,double _z):C2D(_x,_y),z(_z){ }
        double getDistance()
        {
            return sqrt(x*x+y*y+z*z);
        }
};
int main()
{
    double x_2D,y_2D;
    double x1_3D,y1_3D,z1_3D;
    double x2_3D,y2_3D,z2_3D;
    cin>>x_2D>>y_2D;
    cin>>x1_3D>>y1_3D>>z1_3D;
    cin>>x2_3D>>y2_3D>>z2_3D;
    C2D a1(x_2D,y_2D);
    cout<<a1.getDistance()<<endl;
    C3D b1(x1_3D,y1_3D,z1_3D);
    cout<<b1.getDistance()<<endl;
    C3D b2(x2_3D,y2_3D,z2_3D);
    cout<<b2.getDistance()<<endl;
    C2D a2=b2;
    cout<<a2.getDistance()<<endl;
}